package com.example.anew.journey.mynewjourney.logic.setPassword.model;

import android.content.Context;
import android.content.SharedPreferences;

import com.example.anew.journey.mynewjourney.logic.setPassword.bean.UserRegistrationInformationBean;

import static android.content.Context.MODE_PRIVATE;

/**
 * 杭州惟君医疗科技有限公司13
 * Created by 20433 on 2018/3/7
 */

public class SetPasswordModel implements ISSetPasswordModel{
    // 存储注册数据
    @Override
    public void StorageRegistrationData(UserRegistrationInformationBean.DataBean bean,Context mContext) {
        SharedPreferences sharedPreferences = mContext.getSharedPreferences("My_App_Cardiac", MODE_PRIVATE);
        //得到SharedPreferences.Editor对象，并保存数据到该对象中
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putString("my_use_id", bean.id+"");
        editor.putString("my_use_name", bean.cus_name);
        editor.putString("my_use_tel", bean.tel);
        editor.putString("my_use_logo", bean.cus_logo);
        editor.putString("my_use_join_date", bean.join_date+"");
        editor.putBoolean("my_is_login",true);
        editor.putInt("my_stored_data_number",0);
        //保存key-value对到文件中
        editor.commit();
    }

    @Override
    public void storageThirdPartyRegisteredWecht(String name, String ID,Context mContext) {
        SharedPreferences sharedPreferences = mContext.getSharedPreferences("My_App_Cardiac", MODE_PRIVATE);
        //得到SharedPreferences.Editor对象，并保存数据到该对象中
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putString("my_use_weixin", ID);
        editor.putInt("my_stored_data_number",0);
        editor.putBoolean("my_is_login",true);
        //保存key-value对到文件中
        editor.commit();
    }

    @Override
    public void storageThirdPartyRegisteredQQ(String name, String ID,Context mContext) {
        SharedPreferences sharedPreferences = mContext.getSharedPreferences("My_App_Cardiac", MODE_PRIVATE);
        //得到SharedPreferences.Editor对象，并保存数据到该对象中
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putString("my_use_qq", ID);
        editor.putBoolean("my_is_login",true);
        //保存key-value对到文件中
        editor.commit();
    }
}
